package com.sinry.middleware.messages.producer;

import com.sinry.message.enums.RabbitQueue;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.ReturnedMessage;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.stereotype.Service;

/**
 * @author linxinlei
 * @project sinry-cloud
 * @description 默认生产者
 * @date 2022/8/7
 **/
@Slf4j
@Service
public class DefaultMessageProducer implements MessageProducer {

    @Override
    public void send(Object data) {
        log.error("undefine producer!!");
    }

    @Override
    public boolean inQueue(RabbitQueue rabbitQueue) {
        return false;
    }

    @Override
    public void returnedMessage(ReturnedMessage returned) {
        log.info("default producer return message: {}", returned.getMessage());
    }

    @Override
    public void confirm(CorrelationData correlationData, boolean ack, String cause) {
        log.info("default producer confirm: ack {}, cause {}", ack, cause);
    }
}
